home *** CD-ROM | disk | FTP | other *** search
/ Champak 43 / Vol 43.iso / games / superdog.swf / scripts / DefineSprite_1353 / frame_2 / DoAction.as
Encoding:
Text File  |  2007-06-25  |  2.2 KB  |  101 lines

  1. function jump()
  2. {
  3.    if(canjump == true and dead == false)
  4.    {
  5.       gotoAndStop("Φ╖│");
  6.       play();
  7.       yinc = -10;
  8.       inAir = true;
  9.       canjump = false;
  10.    }
  11. }
  12. stop();
  13. onEnterFrame = function()
  14. {
  15.    if(_parent._parent.pauses == false)
  16.    {
  17.       if(dix == false)
  18.       {
  19.          this._x -= spd;
  20.          long += spd;
  21.          this._xscale = 100;
  22.       }
  23.       else
  24.       {
  25.          this._x += spd;
  26.          long += spd;
  27.          this._xscale = -100;
  28.       }
  29.       if(long >= 150)
  30.       {
  31.          long = 0;
  32.          if(dix == false)
  33.          {
  34.             dix = true;
  35.          }
  36.          else
  37.          {
  38.             dix = false;
  39.          }
  40.       }
  41.       if(acted == false and dead == false)
  42.       {
  43.          jump();
  44.          acted = true;
  45.       }
  46.       if(acted == true and dead == false)
  47.       {
  48.          act_i++;
  49.          if(act_i >= 70)
  50.          {
  51.             act_i = 0;
  52.             acted = false;
  53.          }
  54.       }
  55.       var _loc3_ = 0;
  56.       while(_loc3_ < _parent._parent.land_array.length)
  57.       {
  58.          var _loc5_ = _parent[_parent._parent.land_array[_loc3_]];
  59.          if(this.qfk.hitTest(_loc5_) and _loc5_.noWalk == true)
  60.          {
  61.             if(movRight == true)
  62.             {
  63.                this._x += spd;
  64.             }
  65.             if(movLeft == true)
  66.             {
  67.                this._x -= spd;
  68.             }
  69.          }
  70.          _loc3_ = _loc3_ + 1;
  71.       }
  72.       if(inAir == true)
  73.       {
  74.          if(yinc < 10)
  75.          {
  76.             yinc += g;
  77.          }
  78.          this._y += yinc;
  79.          _loc3_ = 0;
  80.          while(_loc3_ < _parent._parent.land_array.length)
  81.          {
  82.             landObject = _parent[_parent._parent.land_array[_loc3_]];
  83.             var _loc4_ = landObject.getBounds(_parent).yMin;
  84.             if(this.dfk.hitTest(landObject))
  85.             {
  86.                if(this._y - yinc < _loc4_)
  87.                {
  88.                   inAir = false;
  89.                   this._y = _loc4_;
  90.                   yinc = 0;
  91.                   canjump = true;
  92.                   gotoAndStop(2);
  93.                   break;
  94.                }
  95.             }
  96.             _loc3_ = _loc3_ + 1;
  97.          }
  98.       }
  99.    }
  100. };
  101.